<template>
  <el-form ref="form" :model="form" label-width="0px" class="login-container">
    <h2>用户登录</h2>
    <el-form-item >
      <el-input v-model="form.username" placeholder="用户名" type="text"></el-input>
    </el-form-item>
    <el-form-item >
      <el-input v-model="form.password" placeholder="密码" type="password"></el-input>
    </el-form-item>
    <el-form-item class="check-password" >
        <el-checkbox v-model="form.checked" label="记住密码" checked style="position: relative;right: 120px"></el-checkbox>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit" class="bt-submit">登录</el-button>
    </el-form-item>
  </el-form>
</template>
<script>
  //branch1分支提交一次
  //branch1分支提交两次
  export default {
    data() {
      return {
        form: {
          username: '',
          password: '',
          checked:true
        },
        msg:{}
      }
    },
    methods: {
      onSubmit() {
        console.log(this.form);
        this.$store.commit('insertuser',this.form);
        this.$router.push('/home/home1');
      }
    }
  }
</script>
<style scoped>
  .login-container{
    width: 350px;
    margin: 100px auto;
  }
  .check-password{
    margin: 0;
  }
  .bt-submit{
    width: 100%;
  }
</style>
